{% extends "store/blank.html" %}

{% block title %}
    商品添加
{% endblock %}
{% block contenter %}
    <div class="container-fluid">
            <!--添加商品按钮-->
          <div class="row">
                <button class="btn btn-primary col-lg-2 ml-auto" data-toggle="modal" data-target="#goods_modal">添加商品</button>
          </div>
          <h1></h1>
            <!--商品列表-->
          <div class="row">
              <table class="table">
                  <thead>
                    <tr>
                        <th>商品编号</th>
                        <th>商品名称</th>
                        <th>商品类型</th>
                        <th>商品价格</th>
                        <th>商品数量</th>
                        <th>计量单位</th>
                    </tr>
                  </thead>
                  <tbody>
                  {% for g in Goods_list %}
                    <tr>
                        <td>{{g.g_number}}</td>
                        <td>
                            <a href="#">{{ g.g_name }}</a>
                        </td>
                        <td>{{ g.g_type.type }}</td>
                        <td>￥{{ g.g_price  }}元</td>
                        <td>{{ g.g_number }}</td>
                        <td>{{ g.g_unit }}</td>
                    </tr>
                  {% endfor  %}
                  </tbody>
              </table>
          </div>
          <h1></h1>
            <!--分页-->
          <div class="row">
                <ul class="pagination ml-auto">
                    <li class="page-item">
                        <a class="page-link">上一页</a>
                    </li>
                    <li class="page-item">
                        <a class="page-link">1</a>
                    </li>
                    <li class="page-item">
                        <a class="page-link">2</a>
                    </li>
                                        <li class="page-item">
                        <a class="page-link">3</a>
                    </li>
                    <li class="page-item">
                        <a class="page-link">4</a>
                    </li>
                    <li class="page-item">
                        <a class="page-link">下一页</a>
                    </li>
                </ul>
          </div>
        </div>

  <div class="modal fade" id="goods_modal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-label="true">
      <div class="modal-dialog" role="document">
          <div class="modal-content">
              <div class="modal-header">添加商品</div>
              <div class="modal-body">
                  <form class="form" method="post" enctype="multipart/form-data">
                      {% csrf_token %}
                      <div class="form-group">
                        <label class="">商品名称</label>
                        <input class="form-control" type="text" name="goods_name">
                      </div>
                      <div class="form-group">
                        <label class="">商品类型</label>
                        <select class="form-control" name="goods_type">
                            <option>--商品类型--</option>
                            {% for t in type_list %}
                            <option>{{ t.type }}</option>
                            {% endfor %}
                        </select>
                      </div>

                      <div class="form-group">
                        <label class="">商品价格</label>
                        <input class="form-control" type="text" name="g_price">
                      </div>
                      <div class="form-group">
                        <label class="">商品保质期</label>
                        <input class="form-control" type="text" name="g_safe_date">
                      </div>
                   <div class="form-group">
                        <label class="">保质期单位</label>
                        <input class="form-control" type="text" name="g_safe_unit">
                      </div>
                      <div class="form-group">
                        <label class="">商品出场日期</label>
                        <input class="form-control" type="text" name="g_public_date">
                      </div>
                      <div class="form-group">
                        <label class="">商品数量</label>
                        <input class="form-control" type="text" name="goods_number">
                      </div>
                  <div class="form-group">
                        <label class="">商品单位</label>
                        <input class="form-control" type="text" name="goods_unit">
                      </div>
                      <div class="form-group">
                        <label class="">商品描述</label>
                        <textarea class="form-control" name="g_description"></textarea>
                      </div>
                      <div class="form-group">
                        <label class="">商品图片</label>
                        <input class="form-control" type="file" name="g_picture">
                      </div>
                      <button class="btn btn-primary fa-pull-right" type="submit">提交商品</button>
                  </form>
              </div>
          </div>
      </div>
  </div>

{% endblock %}
